import init from './config';
import { request } from './http';
function data(params) {//循环拼接参数
    var val = '?';
    for (let i in params) {
        val += `${i}=${params[i]}&`
    }
    val = val.substring(0, val.length - 1)
    return val
}

const getInfo = (value) => {
    return request(init.methods.GET, init.url.info, value)
}
const carousel = (value) => {
    return request(init.methods.GET, init.url.carousel, value)
}
const sudoku = (value) => {
    return request(init.methods.GET, init.url.sudoku, value)
}
const getDetails = (url,value) => {
    return request(init.methods.GET, init.url.getDetails+url+'/shops', value)
}
const getShops = (url,value) => {
    return request(init.methods.GET, init.url.getShops+url, value)
}
const getImage = (url,value) => {
    return request(init.methods.GET, init.url.getImage+url, value)
}

export const bus = {
    getInfo,
    carousel,
    sudoku,
    getDetails,
    getShops,
    getImage,
}